#!/bin/bash
project_name=$1
project_workspace=$2
source_git_url=$3
project_src=$2$1
remote_branch_name=''
array_name=()
ss=(1 2)
if [ -x "$project_src" ]; then
  cd $project_workspace
  rm -rf $project_name
  git clone $source_git_url
else
   cd $project_workspace
   git clone $source_git_url
fi
cd $project_name
for BRANCH in `git branch -r|sed 's/\*//g'`;
  do 
  name=$(echo $BRANCH | sed "s:remotes/origin/:${remote_branch_name}:") 
  if [ $name != 'HEAD' ] && [ $name != '->' ]
  then
#   len=${#array_name[*]}
#   array_name[$len]=$name
  echo "$name" >>branch.text
   fi
done
